package com.nbsaas.boot.express.rest.convert;

import com.nbsaas.boot.express.data.entity.Express;
import com.nbsaas.boot.express.api.domain.simple.ExpressSimple;

import com.nbsaas.boot.rest.api.Converter;
import java.util.HashMap;
import java.util.Map;

/**
* 快递公司-列表对象转换器
*/

public class ExpressSimpleConvert implements Converter<ExpressSimple, Express> {




@Override
public ExpressSimple convert(Express source) {
    ExpressSimple result = new ExpressSimple();

                result.setNote(source.getNote());
                result.setCode(source.getCode());
                result.setIntro(source.getIntro());
                result.setIcon(source.getIcon());
                result.setName(source.getName());
                result.setTel(source.getTel());
                result.setSortNum(source.getSortNum());
                result.setId(source.getId());
                result.setUrl(source.getUrl());
                if(source.getEnabled()!=null){
                   Map<Integer,String> EnabledMap=new HashMap<>();
                       EnabledMap.put(1,"启用");
                       EnabledMap.put(2,"禁用");
                   String label=  EnabledMap.get(source.getEnabled());
                   result.setEnabledName(label);
                }
                result.setEnabled(source.getEnabled());


    return result;
}

}